import Table from '../../../components/table';
import Section from './section';
import { IData } from '../../api/teachgl/pk/content/query.api';

export default function List({ data }: {
	data: IData[];
}) {
	console.log('aaaaaaaaaaaaaa', data);
	return <>
		<Table
			idfieldname='section'
			data={data}
			index={false}
		>
			<Table.Column<IData> title='节次' dataIndex='section' align='center' render={(v) => {
				// todo 这里可以根据节次不同显示不同内容
				switch (v) {
					case 1:
						// 第一节课
						return <span>第{v}节</span>;
					case 2:
						// 第二节课
						return <span>第{v}节</span>;
					default:
						return <span>第{v}节</span>;
				}
			}} />
			<Table.Column<IData> title='周日' dataIndex='sun' align='center' render={rendercel} />
			<Table.Column<IData> title='周一' dataIndex='mon' align='center' render={rendercel} />
			<Table.Column<IData> title='周二' dataIndex='tue' align='center' render={rendercel} />
			<Table.Column<IData> title='周三' dataIndex='wen' align='center' render={rendercel} />
			<Table.Column<IData> title='周四' dataIndex='thu' align='center' render={rendercel} />
			<Table.Column<IData> title='周五' dataIndex='fri' align='center' render={rendercel} />
			<Table.Column<IData> title='周六' dataIndex='sat' align='center' render={rendercel} />
		</Table>
	</>;
}

function rendercel(section: ITbcurriculums) {
	return <Section key={section && section.course_id} data={section} />;
}
